Skip to content

Conversation

@akalichety-hw
Copy link
Collaborator

@akalichety-hw akalichety-hw commented Mar 20, 2025

https://paypal.atlassian.net/browse/DTPOMERSER-1274
This PR has
loadCurrency-Modified this method to display defaultcurrencyCode if exists else display first currency from the list.
loadCurrencySelection-Modified this method to select defaultcurrencyCode if exists else display first currency from the list.
Created helper method to get defaultcurrency based on the selected country.

Testing:
Used UAT program.

Graphql query:

query {
	 countries (idToken: "{% response 'body', 'req_93bfdcdd1d484d0ca05a6cf019ef04e7', '$.token', 'never', 60 %}") {
		      nodes {
                       code
                       name
                       defaultCurrencyCode
                         currencies {
                           nodes {
                             code
                             name
                         }
                       }
                     }
                   }
                 }

Result:

{
	"data": {
		"countries": {
			"nodes": [
				{
					"code": "CA",
					"name": "Canada",
					"defaultCurrencyCode": "CAD",
					"currencies": {
						"nodes": [
							{
								"code": "CAD",
								"name": "CAD"
							},
							{
								"code": "USD",
								"name": "USD"
							}
						]
					}
				},
				{
					"code": "MX",
					"name": "Mexico",
					"defaultCurrencyCode": "MXN",
					"currencies": {
						"nodes": [
							{
								"code": "MXN",
								"name": "MXN"
							}
						]
					}
				},
				{
					"code": "SE",
					"name": "Sweden",
					"defaultCurrencyCode": "SEK",
					"currencies": {
						"nodes": [
							{
								"code": "EUR",
								"name": "EUR"
							},
							{
								"code": "SEK",
								"name": "SEK"
							}
						]
					}
				},
				{
					"code": "TW",
					"name": "Taiwan",
					"defaultCurrencyCode": "TWD",
					"currencies": {
						"nodes": [
							{
								"code": "TWD",
								"name": "TWD"
							},
							{
								"code": "USD",
								"name": "USD"
							}
						]
					}
				},
				{
					"code": "US",
					"name": "United States",
					"defaultCurrencyCode": "USD",
					"currencies": {
						"nodes": [
							{
								"code": "CAD",
								"name": "CAD"
							},
							{
								"code": "EUR",
								"name": "EUR"
							},
							{
								"code": "USD",
								"name": "USD"
							}
						]
					}
				}
			]
		}
	}
}

@akalichety-hw
Copy link
Collaborator Author

Testing video

Screen.Recording.2025-03-19.at.10.56.07.PM.mov


if (selectedDefaultCurrencyCode == null) {
// If no default currency code is found, use the first currency in the list
selectedDefaultCurrencyCode = currencyCodes.iterator().next().getCode(); // Get the first currency code
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: do not do comments inline, always do them above the line you're commenting for

shubh-hw-dev
shubh-hw-dev previously approved these changes Mar 20, 2025
Copy link
Collaborator

@shubh-hw-dev shubh-hw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

fzhang4-hw
fzhang4-hw previously approved these changes Mar 20, 2025
Set<Currency> currencyCodes = key.getCurrencies(countryCode) != null ?
key.getCurrencies(countryCode) : new HashSet<Currency>();
// Find the country based on the country code
Country selectedCountry = null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this code is duplicated, Can you create method to get country from HyperwalletTransferMethodConfigurationKey?

}

// Helper method to get the DefaultCurrencyCode
private String getDefaultCurrencyCode(@NonNull Country country, @Nullable HyperwalletTransferMethodConfigurationKey keys,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to keep consistent, Let's assign final in all parameters

@grmeyer-hw-dev grmeyer-hw-dev changed the title select defaultcurrencyCode. DTPOMERSER-1274 Select Default currency code Mar 20, 2025
Copy link
Collaborator

@grmeyer-hw-dev grmeyer-hw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me release Core-SDK, than you can also bump the Core-SDK version to get green CI build

@akalichety-hw akalichety-hw dismissed stale reviews from fzhang4-hw and shubh-hw-dev via 473ca74 March 20, 2025 23:37
Copy link
Collaborator

@grmeyer-hw-dev grmeyer-hw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work !!!

@grmeyer-hw-dev grmeyer-hw-dev merged commit 9fd2b4f into master Mar 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants